const { createApp } = Vue;

const app = createApp({
    data() {
        return {
            gameBoard: Array(200).fill(false),
            currentBlock: [
                [1, 1],
                [1, 1]
            ],
            blockX: 4,
            blockY: 0
        };
    },
    mounted() {
        this.updateBoard();
        setInterval(() => {
            this.moveBlockDown();
        }, 500);
    },
    methods: {
        updateBoard() {
            this.gameBoard = Array(200).fill(false);
            for (let y = 0; y < this.currentBlock.length; y++) {
                for (let x = 0; x < this.currentBlock[y].length; x++) {
                    if (this.currentBlock[y][x]) {
                        const index = (this.blockY + y) * 10 + (this.blockX + x);
                        if (index >= 0 && index < this.gameBoard.length) {
                            this.gameBoard[index] = true;
                        }
                    }
                }
            }
        },
        moveBlockDown() {
            this.blockY++;
            this.updateBoard();
        }
    }
});

app.mount('#app');    